function output = fn_dcdd_dep(D0i,delta,R1,D0,chi,s,phi,dist_d,d_min,d_max)

if D0i*R1<delta %% SAME
    output = 0;
else
    
    f         = @(x) max(x*R1-delta,0).*pdf(dist_d,x);
    uninsured = integral(f,d_min,d_max);

    non_zero = (fn_alphaF(delta,R1,D0,chi,s,phi,dist_d,d_min,d_max)>0);
    ratio    = (1-dist_d.cdf(delta/R1))/uninsured*non_zero;
    
    output = (1-fn_alphaF(delta,R1,D0,chi,s,phi,dist_d,d_min,d_max)).*(1-ratio*(D0i*R1-delta));
end

% if D0i*R1<delta
%     output = 0;
% else
%     output = 1 - fn_alphaF(delta,R1,D0,chi,s,phi,dist_d,d_min,d_max) + ...
%         fn_dalphadd(delta,R1,D0,chi,s,phi,dist_d,d_min,d_max).*(D0i*R1 - delta);
% end

end